#ifndef _CENTITY_H
#define _CENTITY_H

#include <vector>
#include <queue>
#include "defs.h"
#include "CFPS.h"
#include "CSurface.h"

class CEntityCol;
class entityEffect;
bool operator< (const entityEffect& a, const entityEffect& b);

class CEntity {

	private:
		SDL_Surface *entitySurface;

	protected:
		float x;
		float y;
		float speedX;
		float speedY;
		float accelX;
		float accelY;
		float maxSpeed;
		int effectFlags;

	public:
		static std::vector<CEntity*> entityList;
		static std::vector<CEntityCol> collisionList;
		static std::priority_queue<entityEffect> entityEffects;

		CEntity();

		void setPos(float x, float y);
		float getPosX();
		float getPosY();
		float getSpeedX();
		float getSpeedY();
		void addEffectFlag(int flag);
		void removeEffectFlag(int flag);
		void clearEffectFlags();
		
		virtual bool onLoad(char* file);
		virtual void onMove();
		virtual void onRender(SDL_Surface* destSurface);
		virtual void onLoop();
		virtual void onCleanup();

		~CEntity(){}
};

class CEntityCol {

	public:
		CEntity *e1;
		CEntity *e2;

	CEntityCol(){
		e1 = NULL;
		e2 = NULL;
	}

	~CEntityCol(){
		e1 = NULL;
		e2 = NULL;
	}
};

class entityEffect {

	public:
		int effect;
		int offTime;

		entityEffect(){
			effect = 0;
			offTime = 0;
		}
};

#endif